<?php
/**
 * 内容管理视图
 *
 *
 *
 */
// 排序
$arr_orderby    = array(
    'id'        => '&orderby=id',
    'job_name'  => '&orderby=job_name',
    'create_time'=> '&orderby=create_time',
    'end_time'  => '&orderby=end_time',
    'display'  => '&orderby=display',
    'num'       => '&orderby=num',
    'appnum'    => '&orderby=appnum',
    );
$orderby    = strtolower(trim(@$_GET['orderby']));
if(array_key_exists($orderby, $arr_orderby)) {
    $order_asc  = @(int)$_GET['desc'];
    $arr_orderby[$orderby] .= $order_asc == 0 ? '&desc=1' : '&desc=0';
} else {
    $arr_orderby['id'] .= '&desc=0';
}

// 保存数据框架名
$save_frame = $_SESSION[$G_admin_session_key]['save_frame'];
$back_url   = get_current_url();
// 将当前URL保存在Cookie中，避免复杂的URL字符串
cookie('back_url', strcode($back_url));
$url_cur    = get_current_url(array('orderby', 'desc'));



/**
 * 搜索参数处理
 *
 */
// 关键字
$key            = trim(@$_GET['key']);
// 是否包含子类
$class_id       = @(int)$_GET['class_id'];
$class_all      = @(int)$_GET['class_all'];
$chk_class_all  = ($class_all==1) ? ' checked' : '';
// 是否有效
$display       = trim(@$_GET['display']);
$chk_display_all   = '';
$chk_display__1    = '';
$chk_display_1     = '';
if($display == -1) {
    $chk_display__1 = ' checked';
} elseif($display == 1) {
    $chk_display_1 = ' checked';
} else {
    $chk_display_all = ' checked';
}


$begin_date = @$_GET['begin_date'];
$end_date   = @$_GET['end_date'];
$is_ad      = @(int)$_GET['is_ad'];

$dsp_ad     = ($is_ad == 1) ? 'style="display:block"':'style="display:none"';



$chk_haveimg    = @(int)$_GET['haveimg'] == 1 ? ' checked':'';
$chk_top        = @(int)$_GET['top'] == 1 ? ' checked':'';
$chk_new        = @(int)$_GET['new'] == 1 ? ' checked':'';
$chk_recommend  = @(int)$_GET['recommend'] == 1 ? ' checked':'';



// + -------------------------------------- + //
// 排序处理 - 为排序加上小图标

$order_by   = @trim($_GET['orderby']);
$order_desc = @(int)$_GET['desc'];

if($order_by != '') {
    $order_desc = ($order_desc!=1) ? 'sort_asc' : 'sort_desc' ;
    $this_param_style  = $order_by . '_style';
    $$this_param_style = '<div class="' . $order_desc . '"></div>';
}

// + -------------------------------------- + //

require($abs_admin_cppath . '/header.php');
?>
<SCRIPT LANGUAGE="JavaScript" SRC="<?php echo $url_global['common']; ?>/js/popcalendar.js"></SCRIPT>





<div class="sp_height_5px"></div>
<div class="datacontainer1" id="listDiv">
<form action="<?php echo $mod_url['li'] ?>" name="search" method="get">
<div class="new_line">
<input type="hidden" name="mod" value="<?php echo $mod ?>">
<input type="hidden" name="action" value="<?php echo $action ?>">
<input type="hidden" name="cata" value="<?php echo $cata ?>">



	<div class="spW10 fl"></div>
	<a href="<?php echo $mod_url['add'] ?>"  class="btn fl">新增职位</a>


<INPUT TYPE="radio" NAME="display" id="display_all" value="0" <?php echo $chk_display_all?>> <label for="display_all">所有</label>
<INPUT TYPE="radio" NAME="display" id="display__1" value="-1" <?php echo $chk_display__1?>> <label for="display__1">不显示</label>
<INPUT TYPE="radio" NAME="display" id="display_1" value="1" <?php echo $chk_display_1?>> <label for="display_1">显示</label>
&nbsp;&nbsp;

<input type="text" name="key" value="<?php echo $key?>" size="10" class="text">


	<input type="submit" value="查询" class="btn">
	&nbsp;&nbsp;
</div>
</form>

<form action="<?php echo $mod_url['del'] ?>" name="items_form" method="post" target="<?php echo $save_frame?>" onsubmit="return submit_select_items(this.name, 'item_id[]');">
<TABLE BORDER="0" CELLPADDING="4" CELLSPACING="1" width="100%" class="list_table">
<THEAD>
	<TR class="list_head">
		<TH scope=col width="30"><a href="<?php echo $url_cur ?><?php echo $arr_orderby['id'] ?>"><?php echo $id_style;?>#</a></TH>
		<TH scope=col><a href="<?php echo $url_cur ?><?php echo $arr_orderby['job_name'] ?>"><?php echo $job_name_style;?>职位名称</a></TH>
		<TH scope=col width="200"><a href="<?php echo $url_cur ?><?php echo $arr_orderby['end_time'] ?>"><?php echo $end_time_style;?>有效时间</a></TH>
		<TH scope=col width="70"><a href="<?php echo $url_cur ?><?php echo $arr_orderby['create_time'] ?>"><?php echo $create_time_style;?>发布时间</a></TH>
		<TH scope=col width="60"><a href="<?php echo $url_cur ?><?php echo $arr_orderby['num'] ?>"><?php echo $num_style;?>人数</a></TH>
		<TH scope=col width="60"><a href="<?php echo $url_cur ?><?php echo $arr_orderby['display'] ?>"><?php echo $display_style;?>显示</a></TH>
		<TH scope=col width="80"><a href="<?php echo $url_cur ?><?php echo $arr_orderby['appnum'] ?>">申请</a></TH>
		<TH scope=col width="100">操作</TH></TR></THEAD>
<TBODY>
<?php
$tr_class   = '';
if(!empty($record) && sizeof($record) > 0) {
    foreach($record as $k=>$v) {
        $tr_class   = $tr_class != 'tr0' ? 'tr0' : 'tr1';
        $id     = $v['id'];
        $job_name   = htmlspecialchars($v['job_name']);

        $num    = @(int)$v['num'];
        $appnum = @(int)$v['appnum'];
        $anynum = @(int)$v['anynum'];
        $anytime= @(int)$v['anytime'];
        $begin_time = @(int)$v['begin_time'];
        $end_time   = @(int)$v['end_time'];



        if($anynum == 1) $txt_num = '不限';
        else $txt_num = $num;
        //$txt_display= $v['display'] == 1 ? "<span class=\"font_green\">√</span>" : "<span class=\"font_red\">×</span>";
        if($v['display'] == 1) {
			$txt_display = "<div class=\"btn_yes\" onclick=\"listTable.toggle(this, 'display', 1, '$id')\">{$v['display']}</div>";
		} else {
			$txt_display = "<div class=\"btn_no\" onclick=\"listTable.toggle(this, 'display', 1, '$id')\">0</div>";
		}
        $txt_create_time = date(DATE_FORMAT, $v['create_time']);


        if($anytime == 1) {
            $txt_time   = '不限';
            $thisstyle  = '';
        } else {
            $begin_time = date(DATE_FORMAT, $begin_time);
            $end_time   = date(DATE_FORMAT, $end_time);
            $txt_time   = "$begin_time - $end_time";
            $thisstyle  = 'time01';
        }



        // 截取
        $job_name_cut   = (zh_strlen($job_name)>=48)? zh_substr($job_name, 48) : $job_name;




?>
	<TR class="<?php echo $tr_class; ?>" onmouseover="return chgBg(this, 1);" onmouseout="return chgBg(this, 0);">
		<TD width="30" class="textC"><input type="checkbox" value="<?php echo $id ?>" name="item_id[]"></TD>
		<TD>&nbsp;<span title="<?php echo $job_name;?>" onclick="listTable.edit(this, 'edit_job_name', '<?php echo $id;?>')"><?php echo $job_name_cut;?></span></TD>
		<TD width="200" class="<?php echo $thisstyle;?> textC" title="<?php echo $txt_time ?>"><?php echo $txt_time ?></TD>
		<TD width="70" class="time01 textC"><?php echo $txt_create_time ?></TD>
		<TD width="60" class="textC"><?php echo $txt_num ?></TD>
		<TD width="60" class="textC"><?php echo $txt_display ?></TD>
		<TD width="80" class="textC"><?php echo $appnum ?>次 [<a href="<?php echo $mod_url['app'] ?>&job_id=<?php echo $id ?>">查看</a>]</TD>
		<TD width="100">
			<a href="<?php echo $mod_url['modify'] ?>&id=<?php echo $id ?>" class="btn_modify fl" title="修改内容">修改</a> 
			<a href="<?php echo $mod_url['del'] ?>&item_id=<?php echo $id ?>" target="<?php echo $save_frame ?>" onclick="return del_this();" class="btn_del fl" title="删除内容">删除</a>
		</TD></TR>
<?php
    }
} else {
?>
<TR class="tr0" onmouseover="return chgBg(this, 1);" onmouseout="return chgBg(this, 0);"><TD colspan="7">没有或没有找到合适的记录！</TD></TR>
<?php
}
?>
</TBODY>
</TABLE>
<?php
// 分页
$page_info  = "共 $record_total 条记录 每页 $page_size 条 共 $page_total 页 ";
$page_list  = get_page_nav($page_total);
?>
<div class="page_nav">
	<div class="page_info">
		<?php echo $page_info ?>
	</div>
	<div class="page_list_pre">
		&nbsp;&nbsp;<a href="javascript:void(0);" onclick="chkbox_sel_all('items_form', 'item_id[]');"><B>全选</B></a> <a href="javascript:void(0);" onclick="chkbox_sel_reverse('items_form', 'item_id[]');"><B>反选</B></a>
	</div>
	<div class="page_list">
		<?php echo $page_list?>
	</div>
</div>

<div class="new_line">
<input type="submit" name="del" value="删除" class="btn fl">
<input type="hidden" name="deltype" value="all">

</div>
</form>
		</div>
</div>

<?php
require($abs_admin_cppath . '/footer.php');
?>